#ifndef BAIDUVOICE_H
#define BAIDUVOICE_H

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QScriptValue>
#include <QScriptEngine>
#include <QScriptValueIterator>
#include <QFile>
#include <QObject>
#include<QDebug>
#include <QDataStream>

class BaiduVoice : public QObject
{
    Q_OBJECT
public:
    explicit BaiduVoice(QObject *parent = 0);

    Q_INVOKABLE void getText(QString para_API_id, QString para_API_access_token,QString para_API_language, QString para_API_record_path);
    Q_INVOKABLE QString return_str();
    Q_INVOKABLE void set_path(QString path);
    Q_INVOKABLE void set_gettext();

    Q_PROPERTY(QString str READ str  NOTIFY strtextchange )
    QString str()
    {
        return strText;
    }


signals:
    void strtextchange();

public slots:
    void replyFinish(QNetworkReply*);

private:
    QString strText;

    QNetworkAccessManager *manager;
    QNetworkRequest *req;
    QString API_access_token;
    QString API_id;
    QString API_key;
    QString API_secret_key;
    QString API_record_path;
    QString API_language;
    char * m_buf;
    int flag;
};

#endif // BAIDUVOICE_H
